package com.salmon.study;


import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.salmon.study.actors.MasterActor;
import com.salmon.study.message.Result;

public class HelloAkka {

    public static void main(String[] args) throws Exception {
        ActorSystem _system = ActorSystem.create("helloAkka");

        ActorRef master = _system.actorOf(Props.create(MasterActor.class), "master");

        master.tell("my name is hello you name is wang", ActorRef.noSender());

        System.out.println(master.path());

        Thread.sleep(500);

        master.tell(new Result(), ActorRef.noSender());

        System.out.println(">>> Press ENTER to exit <<<");
        try {
            System.in.read();
        } finally {
            _system.terminate();
        }
    }
}
